import { h } from 'vue';
import { NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '序号',
    key: 'id',
    align: "center",
  }, {
    title: '订单号',
    key: 'danhao',
    align: "center",
  }, {
    title: '用户id',
    key: 'user_id',
    align: "center",
  }, {
    title: '设备号',
    key: 'charge_id',
    align: "center",
  }, {
    title: '端口号',
    key: 'duankou',
    align: "center",
  }, {
    title: '金额',
    key: 'money',
    align: "center",
  }, {
    title: '平台',
    key: 'pingtai',
    align: "center",
    render(row) {
      if (row.pingtai == 0) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('微信小程序'),
          },
        );
      } else if (row.pingtai == 1) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('抖音小程序'),
          },
        );
      } else if (row.pingtai == 2) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('支付宝小程序'),
          },
        );
      }
    }
  }, {
    title: '门店名称',
    key: 'wdtitle',
    align: "center",
  }, {
    title: '设备地址',
    key: 'dizhi',
    align: "center",
  }, {
    title: '开始时间',
    key: 'sdate',
    align: "center",
  }, {
    title: '状态',
    key: 'status',
    align: "center",
    render(row) {
      if (row.status == 1) {
        return h(
          NTag,
          {
            type: 'default',
          },
          {
            default: () => ('未支付'),
          },
        );
      } else if (row.status == 2) {
        return h(
          NTag,
          {
            type: 'primary',
          },
          {
            default: () => ('已支付'),
          },
        );
      } else if (row.status == 3) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('正在充电'),
          },
        );
      } else if (row.status == 4) {
        return h(
          NTag,
          {
            type: 'default',
          },
          {
            default: () => ('预支付'),
          },
        );
      } else if (row.status == 5) {
        return h(
          NTag,
          {
            type: 'info',
          },
          {
            default: () => ('已完成'),
          },
        );
      } else if (row.status == 6) {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('放电失败'),
          },
        );
      } else if (row.status == 7) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('已取消'),
          },
        );
      } else if (row.status == 8) {
        return h(
          NTag,
          {
            type: 'warning',
          },
          {
            default: () => ('已退款'),
          },
        );
      }
    }
  }
];
